var  router=require("express").Router();

router.get("/down",function (req,res,next){
  res.download(__dirname+"/07.js","download.text");
});

router.get("/json",function (req,res,next){
  res.json("{name:'kaka',job:'footballplayer'}");
});

router.get("/redirect",function (req,res,next){
  // res.redirect("http://baidu.com");
  if(req.query.id === "001"){
    res.redirect("http://baidu.com");
  }

  else{
    res.send("id !== 001");
  }
});

router.get("/r2",function (req,res,next){
  res.redirect("json");//这个是相对路径，等同于 lesson12/r2 => lesson12/json
})



moudule.exports=router;
